<?php
/**
 * Description
 *
 * PHP version 7
 *
 * @category Custom
 * @package  Custom
 * @author   ryu <mo5467@126.com>
 * @date     2020-04-24 00:32:49
 * @lastTime 2020-05-01 23:00:12
 * @license  https://opensource.org/licenses/MIT MIT License
 * @link     none
 */

namespace Design\Structural\Composite;

class Form implements Renderable
{

    private $elements = [];


    public function addElement(Renderable $element)
    {
        $this->elements[] = $element;

    }//end addElement()


    public function render(): string
    {
        $formCode = '<form>';

        foreach ($this->elements as $element) {
            $formCode .= $element->render();
        }

        $formCode .= '</form>';

        return $formCode;

    }//end render()


}//end class
